home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Jan, 1999
- // Author: Karan Singh
- //
- // Description:
- // This script adds the selected shape as a target for the
- // specified blendShape node.
- //
-
-
- global proc
- blendShapeAddBaseTarget(string $bsNode)
- //
- // Description:
- // Add selected item as a target to the blendShape node.
- //
- {
- string $sel[]=`ls -sl -tr`;
-
- if (size($sel) != 1)
- error("Select one base shape to add as target.");
-
- if ("blendShape" != nodeType($bsNode)) {
- error("Argument should be a blendShape node.");
- }
-
- string $resel[]=`duplicate $sel[0]`;
-
-
- if (size($resel)) {
- // Find a multiIndex for the new target
- //
- int $wc = `blendShape -q -wc $bsNode`;
- int $mi = bsMultiIndexForTarget($bsNode,$wc-1);
-
- if (-1 == $mi) {
- $mi = $wc;
- } else {
- $mi = $mi+1;
- }
-
- if (catch(`blendShape -e -t $sel[0] $mi $resel[0] 1 $bsNode`)) {
- delete($resel[0]);
- }
-
- // we also have to check the weightCount to see if it succeeded
- // since under some conditions the blendShape -e command does not
- // throw during errors.
- //
- int $newwc = `blendShape -q -wc $bsNode`;
- if ($newwc == $wc) {
- delete($resel[0]);
- }
- }
- }
-